home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-10-25 | 6.0 KB | 235 lines | [TEXT/MPS ] |
- ; Copyright © 1987-1990 by Apple Computer, Inc. All rights reserved.
- ; UTabTEView assembly language routines
- CASE ON
- STRING ASIS
-
- PRINT OFF
- INCLUDE 'ToolEqu.a'
- INCLUDE 'QuickEqu.a'
-
- INCLUDE 'Macros.a'
- LOAD 'ProgStrucMacs.d'
- LOAD 'FlowCtlMacs.d'
- PRINT ON
-
- **************************************************************************
- ** Record templates and Global Data area **
- **************************************************************************
- GlobalData RECORD EXPORT
- ALIGN 4
- EXPORT curTabTEView, HookedCQDProcsPtrOffset, OldTEHooksRecOffset, InMyHook
-
- HookedCQDProcsPtrOffset DS.W 1 ; Offset in SELF of the Pointer to the
- ; HookedTheProcsPointer
- OldTEHooksRecOffset DS.W 1 ; Offset in SELF of the Pointer to the
- ; OldTEHooksRec
- curTabTEView DC.L 0 ; provides context from
- ; the TE Hooks to the Bottleneck procs
- InMyHook DC.W 0
- ENDR
-
- ; OldTEHooksRec structure
-
- OldTEHooksRec RECORD EXPORT
- drawHook EQU 0 ; [ProcPtr]
- widthHook EQU 4 ; [ProcPtr]
- hitTestHook EQU 8 ; [ProcPtr]
- EOLHook EQU $C ; [ProcPtr]
- ENDR
-
-
- ;========================================
- ; myTEDrawHook
- ;========================================
- ; on entry A3: pointer to TERec
- ; A1: Scratch
- ;
- EXPORT PROCEDURE MYTEDRAWHOOK
- Seg 'TERes'
- VAR oldGrafPort:L ; the GrafPort found in the TE
- VAR oldGrafProcs:L ; the grafprocs pointer found in the TE's grafport
- VAR oldCurTEView:L ; the saved setting of the curTEView
-
- BEGIN with=GlobalData
-
- MOVEM.L A2/A4,-(SP) ; we'll need this back
-
- ; get SELF into A4 from the refcon
- MOVE.L teFont(A3),A1 ;get handle
- MOVE.L (A1),A1 ;first dereference
- MOVE.L teRefCon(A1),A4
-
- ; Make SELF available to the hooked grafprocs that will be invoked later
- ; save the old curTabTEView first
- MOVE.L curTabTEView(A5), oldCurTEView(FP)
- MOVE.L A4,curTabTEView(A5)
-
- ; get pointer to our hooked grafprocs into A1
- MOVE.L (A4),A1
- Add.W HookedCQDProcsPtrOffset(A5), A1
- MOVE.L (A1),A1
-
- ; get the port in use by TE
- MOVEA.L teGrafPort(A3),A2
- MOVE.L A2,oldGrafPort(FP) ;we'll need this back
-
- ; save its old grafprocs pointer
- MOVE.L grafProcs(A2),oldGrafProcs(FP)
-
- ; stuff in the pointer to our grafprocs
- MOVE.L A1,grafProcs(A2)
-
- ; get pointer to the oldDrawHook
- MOVE.L (A4),A1
- Add.W OldTEHooksRecOffset(A5), A1
- MOVE.L OldTEHooksRec.drawHook(A1),A1
-
- ; restore the munged registers
- MOVEM.L (SP)+,A2/A4
-
-
- ; Call through to the original routine
- JSR (A1)
-
-
- ; restore the old curTabTEView, grafprocs and flag that showed we were hooked in
-
- MOVE.L oldCurTEView(FP), curTabTEView(A5)
- MOVE.L oldGrafPort(FP),A1
- MOVE.L oldGrafProcs(FP),grafProcs(A1)
-
- RETURN
- EndP
-
-
- ;========================================
- ; myTEWidthHook
- ;========================================
- ; on entry A3: pointer to TERec
- ; A1: Scratch
- ;
- EXPORT PROCEDURE MYTEWIDTHHOOK
- Seg 'TERes'
- VAR oldGrafPort:L ; the GrafPort found in the TE
- VAR oldGrafProcs:L ; the grafprocs pointer found in the TE's grafport
- VAR oldCurTEView:L ; the saved setting of the curTEView
-
- BEGIN with=GlobalData
-
- MOVEM.L A2/A4,-(SP) ; we'll need this back
-
- ; get SELF into A4 from the refcon
- MOVE.L teFont(A3),A1 ;get handle
- MOVE.L (A1),A1 ;first dereference
- MOVE.L teRefCon(A1),A4
-
- ; Make SELF available to the hooked grafprocs that will be invoked later
- ; save the old curTabTEView first
- MOVE.L curTabTEView(A5), oldCurTEView(FP)
- MOVE.L A4,curTabTEView(A5)
-
- ; get pointer to our hooked grafprocs into A1
- MOVE.L (A4),A1
- Add.W HookedCQDProcsPtrOffset(A5), A1
- MOVE.L (A1),A1
-
- ; get the port in use by TE
- MOVEA.L teGrafPort(A3),A2
- MOVE.L A2,oldGrafPort(FP) ;we'll need this back
-
- ; save its old grafprocs pointer
- MOVE.L grafProcs(A2),oldGrafProcs(FP)
-
- ; stuff in the pointer to our grafprocs
- MOVE.L A1,grafProcs(A2)
-
- ; get pointer to the oldDrawHook
- MOVE.L (A4),A1
- Add.W OldTEHooksRecOffset(A5), A1
- MOVE.L OldTEHooksRec.widthHook(A1),A1
-
- ; restore the munged registers
- MOVEM.L (SP)+,A2/A4
-
-
- ; Call through to the original routine
- JSR (A1)
-
-
- ; restore the old curTabTEView, grafprocs and flag that showed we were hooked in
-
- MOVE.L oldCurTEView(FP), curTabTEView(A5)
- MOVE.L oldGrafPort(FP),A1
- MOVE.L oldGrafProcs(FP),grafProcs(A1)
-
- RETURN
- EndP
-
-
- ;========================================
- ; myTEHitTestHook
- ;========================================
- ; on entry A3: pointer to TERec
- ; A1: Scratch
- ;
- ;
- ;
- ;
- EXPORT PROCEDURE MYTEHITTESTHOOK
- Seg 'TERes'
- VAR oldGrafPort:L ; the GrafPort found in the TE
- VAR oldGrafProcs:L ; the grafprocs pointer found in the TE's grafport
- VAR oldCurTEView:L ; the saved setting of the curTEView
-
- BEGIN with=GlobalData
-
- MOVEM.L A2/A4,-(SP) ; we'll need this back
-
- ; get SELF into A4 from the refcon
- MOVE.L teFont(A3),A1 ;get handle
- MOVE.L (A1),A1 ;first dereference
- MOVE.L teRefCon(A1),A4
-
- ; Make SELF available to the hooked grafprocs that will be invoked later
- ; save the old curTabTEView first
- MOVE.L curTabTEView(A5), oldCurTEView(FP)
- MOVE.L A4,curTabTEView(A5)
-
- ; get pointer to our hooked grafprocs into A1
- MOVE.L (A4),A1
- Add.W HookedCQDProcsPtrOffset(A5), A1
- MOVE.L (A1),A1
-
- ; get the port in use by TE into A2
- MOVEA.L teGrafPort(A3),A2
- MOVE.L A2,oldGrafPort(FP) ;we'll need this back
-
- ; save its old grafprocs pointer
- MOVE.L grafProcs(A2),oldGrafProcs(FP)
-
- ; stuff in the pointer to our grafprocs
- MOVE.L A1,grafProcs(A2)
-
- ; get pointer to the oldDrawHook
- MOVE.L (A4),A1
- Add.W OldTEHooksRecOffset(A5), A1
- MOVE.L OldTEHooksRec.hitTestHook(A1),A1
-
- ; restore the munged registers
- MOVEM.L (SP)+,A2/A4
-
-
- ; Call through to the original routine
- JSR (A1)
-
-
- ; restore the old curTabTEView, grafprocs and flag that showed we were hooked in
-
- MOVE.L oldCurTEView(FP), curTabTEView(A5)
- MOVE.L oldGrafPort(FP),A1
- MOVE.L oldGrafProcs(FP),grafProcs(A1)
-
- RETURN
- EndP
-
- END